<!--  -->
<template>
  <div>
    <div class="type_dialog">
      <el-dialog :visible.sync="dialogVisible" width="500px" height="210px">
        <template slot="title">
          <div class="tishi">
            <span> {{ title }}</span>
          </div>
        </template>
        <div>
          <el-input
            type="text"
            placeholder="请输入内容"
            v-model="typetext"
            maxlength="15"
            show-word-limit
          >
          </el-input>
          <slot></slot>
        </div>
        <div slot="footer" class="dialog-footer">
          <button class="btn_add" @click="showType">确 定</button>
          <button @click="dialogVisible = false" class="can_btn">取 消</button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      typetext: "",
      dialogVisible: false,
      istype: "", //操作类型
      title: "",
    };
  },
  props: {},
  created() {},
  methods: {
    showdialog(title, type, name) {
      this.title = "";
      this.dialogVisible = true;
      this.istype = type;
      this.title = title;
      if (this.istype == "chang") {
        this.typetext = name;
      }else{
         this.typetext =""
      }
    },
    showdialog2(){
      this.dialogVisible = false;
    },
    showType() {
      if (this.istype == "add") {
        this.dialogVisible = false;
        this.$emit("showType", this.istype, this.typetext);
      } else if (this.istype == "chang") {
        this.dialogVisible = false;
        this.$emit("showType", this.istype, this.typetext);
      }
    },
  },
};
</script>

<style scoped lang="scss">
@import "./style.scss";
</style>
<style lang="scss">
.type_dialog {
  .el-dialog__header {
    border-bottom: 1px solid #f5f5f5;
  }
  .el-dialog__footer {
    text-align: center;
  }
}
</style>
